home *** CD-ROM | disk | FTP | other *** search
Wrap
' Configuration routines for host mode. ' ' DO NOT COMPILE THIS FILE BY ITSELF! ' ' This file is a part of the complete HOST.QSC and will not compile ' alone. To recompile the host scripts, select Scripts/Compile from ' the QmodemPro for Windows menu and select HOST.QSC in the "Compile ' script" dialog box. This file will automatically be compiled as ' part of the full script. declare sub GetPrivateProfileString lib "kernel32" alias "GetPrivateProfileStringA" (section as string, entry as string, default as string, buffer as string, bufsize as integer, filename as string) declare function GetPrivateProfileInt lib "kernel32" alias "GetPrivateProfileIntA" (section as string, entry as string, default as integer, filename as string) as integer declare sub WritePrivateProfileString lib "kernel32" alias "WritePrivateProfileStringA" (section as string, entry as string, data as string, filename as string) declare function GetDlgItem lib "user32" (hwindow as integer, id as integer) as integer declare function EnableWindow lib "user32" (hwindow as integer, on as integer) as integer function GetHostProfileString(entry as string, default as string) as string dim buf as string buf = space(128) call GetPrivateProfileString("Host", entry, default, buf, 128, "qmwin.ini") GetHostProfileString = buf end function function GetHostProfileInt(entry as string, default as integer) as integer GetHostProfileInt = GetPrivateProfileInt("Host", entry, default, "qmwin.ini") end function sub WriteHostProfileString(entry as string, data as string) call WritePrivateProfileString("Host", entry, data, "qmwin.ini") end sub sub WriteHostProfileInt(entry as string, data as integer) call WriteHostProfileString(entry, str(data)) end sub function GetModemIndex(byval s as string) as integer GetModemIndex = 0 dim i as integer for i = 0 to GetModemCount-1 if OemUpper(s) = OemUpper(GetModemName(i)) then GetModemIndex = i exit function end if next if left(s, 3) = "COM" then i = asc(s(4)) - asc("1") if i >= 0 and i <= 3 then GetModemIndex = i + GetModemCount end if end if end function sub SetupDialog.Init dim count as integer count = GetModemCount dim i as integer for i = 0 to count-1 AddComboBoxItem(HWindow, 111, GetModemName(i)) next AddComboBoxItem(HWindow, 111, "COM1") AddComboBoxItem(HWindow, 111, "COM2") AddComboBoxItem(HWindow, 111, "COM3") AddComboBoxItem(HWindow, 111, "COM4") if modem < GetModemCount then EnableWindow(GetDlgItem(HWindow, 200), False) else Enablewindow(GetDlgItem(HWindow, 200), True) end if modem = GetModemIndex(GetHostProfileString("Modem", "")) end sub function SetupDialog.id(111) as integer if modem < GetModemCount then EnableWindow(GetDlgItem(HWindow, 200), False) else Enablewindow(GetDlgItem(HWindow, 200), True) end if end function function SetupDialog.id(200) as integer dim d as ModemSetupDialog d = ModemSetup if dialogbox(d) = IDOK then ModemSetup = d call WriteHostProfileString("ModemInit", ModemSetup.init) call WriteHostProfileString("ModemAnswer", ModemSetup.answer) call WriteHostProfileString("ModemBusy", ModemSetup.busy) call WriteHostProfileString("ModemOK", ModemSetup.ok) call WriteHostProfileString("ModemRing", ModemSetup.ring) call WriteHostProfileString("ModemRingCount", ModemSetup.ringcount) end if end function sub SetupHost dim d as SetupDialog d = Setup if dialogbox(d) = IDOK then Setup = d if Setup.modeopen then call WriteHostProfileInt("Mode", 0) elseif Setup.modeclosed then call WriteHostProfileInt("Mode", 1) elseif Setup.modecallback then call WriteHostProfileInt("Mode", 2) end if call WriteHostProfileString("MaxTime", Setup.maxtime) call WriteHostProfileString("DosPassword", Setup.dospass) call WriteHostProfileString("ShutdownPassword", Setup.shutdownpass) call WriteHostProfileString("DownloadPath", Setup.dlpath) call WriteHostProfileString("UploadPath", Setup.ulpath) call WriteHostProfileInt("SysopAnyPath", Setup.sysopanypath) if Setup.Modem < GetModemCount then call WriteHostProfileString("Modem", GetModemName(Setup.modem)) else call WriteHostProfileString("Modem", "COM"+chr(asc("1")+Setup.modem-GetModemCount)) end if end if end sub sub LoadConfig Setup.modeopen = 0 Setup.modeclosed = 0 Setup.modecallback = 0 select case GetHostProfileInt("Mode", 0) case 0 Setup.modeopen = 1 case 1 Setup.modeclosed = 1 case 2 Setup.modecallback = 1 end select Setup.maxtime = str(GetHostProfileInt("MaxTime", 60)) Setup.dospass = GetHostProfileString("DosPassword", "") Setup.shutdownpass = GetHostProfileString("ShutdownPassword", "") Setup.dlpath = GetHostProfileString("DownloadPath", "") Setup.ulpath = GetHostProfileString("UploadPath", "") Setup.sysopanypath = GetHostProfileInt("SysopAnyPath", 0) Setup.modem = GetModemIndex(GetHostProfileString("Modem", "")) ModemSetup.init = GetHostProfileString("ModemInit", "ATQ0H0S0=0^M") ModemSetup.answer = GetHostProfileString("ModemAnswer", "ATA^M") ModemSetup.busy = GetHostProfileString("ModemBusy", "ATH1M0^M") ModemSetup.ok = GetHostProfileString("ModemOK", "OK") ModemSetup.ring = GetHostProfileString("ModemRing", "RING") ModemSetup.ringcount = str(GetHostProfileInt("ModemRingCount", 1)) end sub